export default {
	methods: {
		checkUserByWechatApp() {
			return new Promise(resolve => {
				let that = this;
				wx.login({
					success(res) {
						that.$u.api.WXCHATAPI.getOpenIdApi({
							code: res.code,
						}).then(res => {
							console.log('loginRes', res.data)
              // 将关键字段存储在vuex之中,方便调用
              that.$u.vuex("vuex_userInfo", res.data);
              that.$u.vuex("vuex_wechatInfo.openId", res.data.openid);
              that.$u.vuex("vuex_wechatInfo.sessionKey", res.data.session_key);
              that.$u.vuex("vuex_isLogin", res.status == 200);
							// 监测完是否注册用户的消息通知,通知各个订阅过该方法的人
							uni.$emit("userLoginMessage");
							resolve(res);
						});
					}
				});
			});
		}
	}
};